package com.hzcx.app.simplechat.ui.setting.presenter;

import android.content.Context;

import com.hzcx.app.simplechat.api.BaseDialogObserver;
import com.hzcx.app.simplechat.base.BaseEmptyBean;
import com.hzcx.app.simplechat.base.BasePresenter;
import com.hzcx.app.simplechat.model.PublicModel;
import com.hzcx.app.simplechat.model.SettingModel;
import com.hzcx.app.simplechat.ui.publicui.bean.ProtocolBean;
import com.hzcx.app.simplechat.ui.publicui.bean.UpdateVersionBean;
import com.hzcx.app.simplechat.ui.setting.bean.VipSettingBean;
import com.hzcx.app.simplechat.ui.setting.contract.AboutContract;
import com.hzcx.app.simplechat.ui.setting.contract.VipSettingContract;
import com.hzcx.app.simplechat.util.app.AppHelper;

import java.util.List;

public class VipSettingPresenter extends BasePresenter<VipSettingContract.View> implements VipSettingContract.Presenter {

    /**
     *  获取我的会员设置
     * @param context
     */
    @Override
    public void getMineVipSetting(Context context) {
        SettingModel.getMintVipSetting(context, new BaseDialogObserver<List<VipSettingBean>>(context) {
            @Override
            protected void onSuccess(List<VipSettingBean> data) {
                mView.settingResult(data);
            }
        });
    }

    /**
     *  修改会员设置
     * @param context
     * @param type
     * @param pos
     */
    @Override
    public void updateVipSetting(Context context, String type, int pos) {
        SettingModel.updateVipSetting(context, type, new BaseDialogObserver<BaseEmptyBean>(context) {
            @Override
            protected void onSuccess(BaseEmptyBean data) {
                mView.updateSuccess(pos);
            }

            @Override
            public void onFailure(Throwable e, String errorMsg) {
                super.onFailure(e, errorMsg);
                mView.updateFail();
            }
        });
    }
}
